package com.kc.gb.device.plugins.slant.dto;

import lombok.Data;

@Data
public class SlantFeedbackMessage {
    private String originalSlantResponse;
    private boolean leftHasError;
    private boolean rightHasError;
    //是否打开左侧光电检测
    private boolean isOpenLeftAutoDetect;
    //是否打开右侧光电检测
    private boolean isOpenRightAutoDetect;
    private boolean isManualMode;
    private String cannotParserReason;
    //左侧斜顶状态
    private SlantState leftSlantState;
    //右侧斜顶状态
    private SlantState rightSlantState;

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("原始报文:");
        stringBuilder.append(originalSlantResponse);
        stringBuilder.append(";");
        if (isOpenLeftAutoDetect) {
            stringBuilder.append("当前手动模式，不接受指令;");
        }
        if (leftHasError) {
            stringBuilder.append("左斜顶报错;");
        }
        if (isOpenLeftAutoDetect) {
            stringBuilder.append("左斜顶光电检测已打开;");
        } else {
            stringBuilder.append("左斜顶光电检测未打开;");
        }
        stringBuilder.append("左斜顶:");
        stringBuilder.append(leftSlantState.getDesc());
        stringBuilder.append(";    ");
        if (rightHasError) {
            stringBuilder.append("右斜顶报错;");
        }
        if (isOpenRightAutoDetect) {
            stringBuilder.append("右斜顶光电检测已打开;");
        } else {
            stringBuilder.append("右斜顶光电检测未打开;");
        }
        stringBuilder.append("右斜顶状态:");
        stringBuilder.append(rightSlantState.getDesc());
        stringBuilder.append(";");
        return stringBuilder.toString();
    }
}
